<template>
  <div class="box">
    <h1>Child1:{{ count }}</h1>
  </div>
</template>

<script>
export default {
  name: "Child1",
  data() {
    return {
      count: 0,
    };
  },
  mounted() {
    console.log(this.$root);

    this.$root.$on("getCount", (value) => {
      this.count += value;
    });
  },
};
</script>

<style scoped>
.box {
  background: yellowgreen;
}
</style>
